/**
 * 
 */
package com.weightcontrol.persistence.entity;

import java.util.Set;

import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/**
 * @author yizhangy
 *
 */
@Entity
@Table(name = "w_profile")
public class Profile extends BaseEntity{
	
	@OneToOne
	private User user;
	
	@ElementCollection
	@OneToMany(fetch = FetchType.LAZY, mappedBy="profile")
	@Cascade({CascadeType.SAVE_UPDATE})
	private Set<Exercise> exercises;
	
	@ElementCollection
	@OneToMany(fetch = FetchType.LAZY, mappedBy="profile")
	@Cascade({CascadeType.SAVE_UPDATE})
	private Set<WeightRecord> weightRecords;
	
	@ElementCollection
	@OneToMany(fetch = FetchType.LAZY, mappedBy="profile")
	@Cascade({CascadeType.SAVE_UPDATE})
	private Set<Consumption> consumptions;

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Set<Exercise> getExercises() {
		return exercises;
	}

	public void setExercises(Set<Exercise> exercises) {
		this.exercises = exercises;
	}

	public Set<WeightRecord> getWeightRecords() {
		return weightRecords;
	}

	public void setWeightRecords(Set<WeightRecord> weightRecords) {
		this.weightRecords = weightRecords;
	}

	public Set<Consumption> getConsumptions() {
		return consumptions;
	}

	public void setConsumptions(Set<Consumption> consumptions) {
		this.consumptions = consumptions;
	}

}
